/*   
 Template Name: Color Admin - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.3.5
 Version: 1.8.0
 Author: Sean Ngu
 Website: http://www.seantheme.com/color-admin-v1.8/admin/
 */

var blue = '#348fe2',
		blueLight = '#5da5e8',
		blueDark = '#1993E4',
		aqua = '#49b6d6',
		aquaLight = '#6dc5de',
		aquaDark = '#3a92ab',
		green = '#00acac',
		greenLight = '#33bdbd',
		greenDark = '#008a8a',
		orange = '#f59c1a',
		orangeLight = '#f7b048',
		orangeDark = '#c47d15',
		dark = '#2d353c',
		grey = '#b6c2c9',
		purple = '#727cb6',
		purpleLight = '#8e96c5',
		purpleDark = '#5b6392',
		red = '#ff5b57';

var handleBasicChart = function (chart) {
	"use strict";
	var d1 = window.chartData.map(function (d) {
		return [Number(d.timestamp*1000), d.order_total];
	});
	if (chart.length !== 0) {
		$.plot(chart, [
			{label: "收入", data: d1, color: purple, shadowSize: 0}
		], {
			series: {
				lines: {show: true},
				points: {show: true}
			},
			xaxis: {
				tickColor: '#ddd',
				timeformat: "%Y/%m/%d-%H:%M",
				mode: "time"
			},
			yaxis: {
				tickColor: '#ddd'
			},
			grid: {
				borderColor: '#ddd',
				borderWidth: 1
			}
		});
	}
};

function getNamespace() {
	if (!!window.gs) {
		return window.gs
	} else {
		window.gs = {};
		return window.gs;
	}
}

var gs = getNamespace();

gs.Chart = function () {
	"use strict";
	return {
		//main function
		init: handleBasicChart
	};
}();
